<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<!DOCTYPE html>
<html lang="zh-CN">

  <head>
  	    <meta charset="utf-8">
  	    <meta name="viewport" content="width=device-width, initial-scale=1">
  	    
  		<title>文件管理</title>
  		<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css">
  		<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  </head>
  
  <body>
  	<div class="container" style="margin-top: 20px;">
  		<div class="row">
  			<div class="col-xs-12">
  				<c:if test="${upload }">
  				<form action="${ctx }/file/manage" enctype="multipart/form-data" class="form-horizontal" method="post">
  					<div class="form-group">
	                   <div class="col-sm-6">
	                   		<input type="hidden" name="upload" value="true"/>
	                    	<input type="file" class="form-control" name="file">
	                   </div>
	                   <div class="col-sm-2">
	                    	<input type="submit" class=" btn btn-primary" value="上传 ">
	                   </div>
             		</div>	
             		<div class="form-group">
	                   <div class="col-sm-2" style="color: green;">
	                   ${msg }
	                   </div>
             		</div>	
  				</form>
  				</c:if>
  			</div>
  		</div>
  		
  		<div class="row">
  			<div class="col-xs-12">
  				<table class="table">
  					<thead>
  						<tr>
  							<th>文件名</th>
  							<th>大小</th>
  						</tr>
  					</thead>
  					<tbody>
  						<c:forEach items="${files }" var="f">
  						<tr>
  							<td>
  							<a href="${ctx }/file/download?fileName=${f.encodeName}" target="_blank">
  							${f.name }
  							</a>
  							</td>
  							<td>${f.size }</td>
  						</tr>
  						</c:forEach>
  					</tbody>
  				</table>
  			</div>
  		</div>
  	</div>
  </body>
</html>